package ice.dao.util;

import java.sql.Connection;
import java.util.List;

/**
 * EntityDB
 * 
 * @author abiao
 */
public class EntityDB extends DBUtil {

    /**
     * 实体库
     */
    private static EntityDB entityDB;

    /**
     * hideme
     */
    private EntityDB() {
    }

    /**
     * 初始化实体库
     */
    public static EntityDB initDB() {
        if (entityDB == null) {
            entityDB = new EntityDB();
        }
        return entityDB;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<TableRow> query(String sql, Object[] params) {
        return new EntityQueryResult(this, sql, params).queryList();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<TableRow> queryForIndex(String sql, Object[] params) {
        return new EntityQueryForIndexResult(this, sql, params).queryList();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void update(String sql, Object[] params) {
        // TODO Auto-generated method stub
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void batchUpdate(List<SqlObject> sqlObList) {
        // TODO Auto-generated method stub
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Connection getConnection() throws Exception {
        return ProxoolPool.getConnection();
    }

}
